package subumbo.micro.model
{
	import flash.events.EventDispatcher;
	import flash.utils.Proxy;
	import flash.utils.flash_proxy;
	
	public dynamic class Model extends Proxy
	{	
		flash_proxy override function callProperty(name:*, ...rest):*
		{
			if(rest.length > 0) return _decorator[name].apply(_decorator, rest);
			else return _decorator[name].apply(_decorator);
		}
		
		
		flash_proxy override function getProperty(name:*):*
		{
			return _decorator[name];
		}
		
		override flash_proxy function setProperty(name:*, value:*):void 
		{
        	_decorator[name] = value;
    	}

		public function init(decorator:Object):void
		{
			_decorator = decorator;
		}
		private var _decorator:Object;
		
		static private const _instance:Model = new Model();
		static public function get instance():Model
		{
			return _instance;
		} 
		
	}
}